package org.groupg.practice.calcConfig.model;

import org.groupg.practice.tableInfo.model.TableInfo;

import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;

public class TableTask {

    private TableInfo tableInfo;
    private List<ExecutionStep> executionSteps;

    public TableTask(TableInfo tableInfo, List<ExecutionStep> executionSteps) {
        this.tableInfo = tableInfo;
        this.executionSteps = executionSteps;
    }

    public TableTask() {
    }

    public TableInfo getTableInfo() {
        return tableInfo;
    }

    public void setTableInfo(TableInfo tableInfo) {
        this.tableInfo = tableInfo;
    }

    public List<ExecutionStep> getExecutionSteps() {
        return executionSteps;
    }

    public void setExecutionSteps(List<ExecutionStep> executionSteps) {
        this.executionSteps = executionSteps;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TableTask tableTask = (TableTask) o;
        return Objects.equals(getTableInfo(), tableTask.getTableInfo()) && Objects.equals(getExecutionSteps(), tableTask.getExecutionSteps());
    }

    @Override
    public int hashCode() {
        int result = Objects.hashCode(getTableInfo());
        result = 31 * result + Objects.hashCode(getExecutionSteps());
        return result;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", TableTask.class.getSimpleName() + "[", "]")
                .add("tableInfo=" + tableInfo)
                .add("executionSteps=" + executionSteps)
                .toString();
    }
}
